﻿/************************************************************************

	File:			testmain.c
	Version:		1.0
	Changes:		A
	Author:			Stanley Lau
	Date:			2010.07.26
	Purpose:		Test Project Main Function

************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include "pak_io.h"

int main( int argn, char** argv )
{
	size_t	len = 0;
	char*	pszU8 = NULL;

	len = _AToU8_win32( argv[1], -1, NULL, NULL );
	PROCESS_ERROR( pszU8 = (char*)malloc( sizeof(char) * len ) );
	_AToU8_win32( argv[1], -1, pszU8, len );

	_CreateDir_win32( pszU8 );
	if( _IsDirExist_win32( pszU8 ) )
		printf( "Exist\n" );
	else
		printf( "No Exist\n" );
	//FILE*	hFileSrc = NULL, *hFileDest = NULL;
	//char*	pszReadBuffer = NULL;
	//size_t	nRead = 0, nRealRead = 0, nReaded = 0;
	//size_t	nRealWrite = 0;
	//long	lFileSize = 0;

	////Read file
	//PROCESS_ERROR( hFileSrc = _OpenFile( "data\\pak_kernel_io.txt", "rb" ) );
	//PROCESS_ERROR( _GetFileSize( hFileSrc, &lFileSize ) );
	//PROCESS_ERROR( pszReadBuffer = (char*)malloc( sizeof(char) * ( lFileSize + 1 ) ) );
	//PROCESS_ERROR( _ReadFile( hFileSrc, pszReadBuffer, (size_t)lFileSize, &nRealRead ) );
	//pszReadBuffer[nRealRead] = 0;
	//printf( "%s\n", pszReadBuffer );
	//printf( "FileSize:%ld\n", lFileSize );

	////Write file
	//PROCESS_ERROR( hFileDest = _OpenFile( "data\\pak_kernel_io_des.txt", "wb" ) );
	//PROCESS_ERROR( _WriteFileAt( hFileDest, "ab", 2, &nRealWrite, 100 ) );
	
Exit0:
	/*if( hFileSrc ) _CloseFile( hFileSrc );
	if( hFileDest ) _CloseFile( hFileDest );
	if( pszReadBuffer )
		free( pszReadBuffer );*/
	return 0;
}